In [1]:
%matplotlib inline
# import network warper demo
import warp_demo_3 as warper

# a necessary library for writing out our transform rules mathematically
from sympy import symbols, lambdify, sin, cos, tanh, exp, log, Max, Piecewise, And
from ipywidgets import interact
import sys
sys.path.append('../demo_python_backend_files')
In [2]:
# our home-made warper 
demo = warper.warp_demo()

# make instance of warper
x1,x2 = symbols('x1 x2')

# define your own rules here using elementary functions like sin, cos, tanh, sinc, or any polynomial combination of x1 and x2
rule1 = x1*x1 - 4
rule2 = x2*x2 - 4

# these two lines feed the transformation rules into the warping function and produce a toy dataset based on them
demo.define_rule(rule1,rule2)
demo.make_pts()

# this line creates an instance of the slider -  if you do not have bokeh installed you can use the demo1.transformation_slider - this uses matplotlib as the backend (and is considerably slower)
demo.transformation_slider()
Out[2]:


In [3]:
# our home-made warper 
demo2 = warper.warp_demo()

# make instance of warper
x1,x2 = symbols('x1 x2')

# define your own rules here using elementary functions like sin, cos, tanh, sinc, or any polynomial combination of x1 and x2
rule1 = tanh(x1 + x2 + tanh(x1))
rule2 = tanh(0.1*x1)

# these two lines feed the transformation rules into the warping function and produce a toy dataset based on them
demo2.define_rule(rule1,rule2)
demo2.make_pts()

# this line creates an instance of the slider -  if you do not have bokeh installed you can use the demo1.transformation_slider - this uses matplotlib as the backend (and is considerably slower)
demo2.transformation_slider()
Out[3]: